home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / comm / net / tf02.lha / TinyFugue / tf-lib / alias.tf next >
Text File  |  1995-08-12  |  1KB  |  33 lines

  1. ;;; Aliases.
  2. ; Create command aliases.  Like simple macros, but no leading '/' is required.
  3. ; syntax:  /alias <name> <command...>
  4. ; syntax:  /unalias <name>
  5.  
  6. /~loaded alias.tf
  7.  
  8. /if ( alias =~ "" ) \
  9.     /echo Note: alias argument substitution has changed since version \
  10.     3.3 beta 8.  %%1 and %%2 now refer to the first and second \
  11.     arguments, as you would expect, instead of the alias name and \
  12.     the first argument, as in the old version.  You can enable the \
  13.     old behavior with "/set alias=old".  You can gag this message \
  14.     if you /set alias to "old" or "new" before you /load this file.%;\
  15. /endif
  16.  
  17. /def -i alias = \
  18.     /if ( {#} < 2 ) \
  19.         /quote -S /~listalias `/list -i alias_%{1-*}%; \
  20.     /else \
  21.         /let body=%-1%;\
  22. ;       The alias_* macro /shifts unless [alias=~"old"] at runtime.
  23.         /def -i -ag -mglob -h"send {%1}*" alias_%1 = \
  24.             /shift $$[alias !~ "old"]%%; \
  25.             %body%; \
  26.     /endif
  27.  
  28. ; note: the parameters below depend directly on the format of the /def above.
  29. /def -i ~listalias = /echo /alias $[substr({9}, 6)] %-14
  30.  
  31. /def -i unalias = /undef alias_%1
  32.  
  33.